package com.winterwar.service.impl;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.winterwar.base.Registration;
import com.winterwar.dao.RegistrationDAO;
import com.winterwar.service.RegistrationManager;

public class RegistrationManagerImpl implements RegistrationManager {

	public Registration get(String regID) {
		Registration reg = dao.get(Integer.valueOf(regID));
		if(reg == null){
			log.warn("Registratoin with ID " + regID + " does not exist in the database.");
		}
		return reg;
	}

	public List getAll() {
		return dao.getAll();
	}

	public void remove(String regID) {
		dao.remove(Integer.valueOf(regID));
	}

	public Registration save(Registration registration) {
		dao.save(registration);
		return registration;
	}

	public List getByConID(String conID, String status) {
		return dao.getByConID(Integer.valueOf(conID), status);
	}

	public void setDAO(RegistrationDAO dao) {
		this.dao = dao;
	}
	
	private RegistrationDAO dao;
	private static Log log = LogFactory.getLog(RegistrationManager.class);
}
